<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="validausuario.jsp"%>
<%
	String perfil = (String)session.getAttribute("perfil");
	if (!perfil.equals("Admin")) {
		response.sendRedirect("accesodenegado.jsp");
		return;
	}	
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Buscar Clientes</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="main.css">
<script src="js/jquery-1.3.2.js" language="JavaScript"></script>
<link rel="Shortcut Icon" href="icono_tm.ico" type="image/x-icon" />
<script type="text/javascript">

function cancelar() {
	window.location.href = "menu.jsp?menu=4";
}	
function buscar(opcion) {
	var campo = $("#campo").val();
	var criterio = $("#criterio").val();
	if (campo == "" || criterio == "") {
		alert("Faltan datos para realizar la busqueda");
		return;
	}
	var url = "SrvOrders?operacion=buscar&campo=" + campo + "&criterio=" + criterio + "&opcion=" + opcion;
	$("#list").load(url);
	
}
</script>
</head>
<body>
<%@ include file="header.jsp" %>
<h2>Busqueda de Orden</h2>
<table>
<tr>
	<th colspan=4>Criterio</th>
</tr>
<tr>
	<td>Buscar por</td>
	<td><select id="campo">
		<option value="orders.orden">Orden</option>
		<option value="orders.nic">NIC</option>
		<option value="clientes.medidor">Medidor</option>
	</select></td>
	<td>Criterio</td>
	<td><input type="text" name="criterio" id="criterio" size=40></td>
</tr>
<tr>
	<td colspan=4><input type="button" onclick="javascript:buscar('<%= (String)request.getParameter("operacion") %>');" name="cmd_buscar" id="cmd_buscar"  value="Buscar">  <input type="button" onclick="javascript:cancelar();" name="cmd_cancelar" id="cmd_cancelar" value="Cancelar"></td>
</tr>

</table>

<div id="list"></div>
<%@ include file="foot.jsp" %>
</body>
</html>